import 'package:flutter/material.dart';
import 'package:test1/pages/widgets/Widget_ListView_Builder_Page.dart';
import 'package:test1/pages/widgets/Widget_ListView_Normal_Page.dart';
import 'package:test1/pages/widgets/Widget_ListView_Separated_Page.dart';

class ListViewPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return ListViewPageState();
  }
}

/**
    ListView({
    Key key,
    Axis scrollDirection = Axis.vertical,//滚动方向
    bool reverse = false,//是否反向显示数据
    ScrollController controller,//设置listview初始位置
    bool primary,
    ScrollPhysics physics,//物理滚动,AlwaysScrollableScrollPhysics()让listview在不满一屏时也能滚动
    bool shrinkWrap = false,
    EdgeInsetsGeometry padding,
    this.itemExtent,//item有效范围
    bool addAutomaticKeepAlives = true,//自动保存视图缓存
    bool addRepaintBoundaries = true,//添加重绘边界
    bool addSemanticIndexes = true,
    double cacheExtent,
    List<Widget> children = const <Widget>[],
    int semanticChildCount,
    })*/

class ListViewPageState extends State<ListViewPage> {

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text("ListView学习"),
        ),
        body: ListView(
          children: <Widget>[
            Container(
                child: FlatButton(
                  onPressed: () =>
                      Navigator.push(
                          context,
                          new MaterialPageRoute(
                              builder: (BuildContext context) {
                                return ListView_Normal_Page();
                              }
                          )
                      ),
                  child: Text("ListView"),
                ),
                color: Color.fromARGB(255, 241, 241, 241)
            ),
            Container(
              height: 1.0,
              color: Color.fromARGB(255, 230, 230, 230),
            ),
            Container(
                child: FlatButton(
                  onPressed: () =>
                      Navigator.push(
                          context,
                          new MaterialPageRoute(
                              builder: (BuildContext context) {
                                return ListView_Builder_Page();
                              })),
                  child: Text("ListView的build方式"),
                ),
                color: Color.fromARGB(255, 241, 241, 241)
            ),
            Container(
              height: 1.0,
              color: Color.fromARGB(255, 230, 230, 230),
            ),
            Container(
                child: FlatButton(
                  onPressed: () =>
                      Navigator.push(
                          context,
                          new MaterialPageRoute(
                              builder: (BuildContext context) {
                                return ListView_Separated_Page();
                              })),
                  child: Text("ListView的separated方式"),
                ),
                color: Color.fromARGB(255, 241, 241, 241)
            ),
            Container(
              height: 1.0,
              color: Color.fromARGB(255, 230, 230, 230),
            ),
          ],
        ),
      ),
    );
  }
}